package com.jushu.storbox.service;

import android.content.Context;

import com.huawei.sharedrive.sdk.android.exception.ClientException;
import com.huawei.sharedrive.sdk.android.model.request.FolderBaseRequest;
import com.huawei.sharedrive.sdk.android.model.request.FolderCreateRequest;
import com.huawei.sharedrive.sdk.android.modelV2.request.FolderCopyRequstV2;
import com.huawei.sharedrive.sdk.android.modelV2.request.FolderListRequestV2;
import com.huawei.sharedrive.sdk.android.modelV2.request.FolderMoveRequstV2;
import com.huawei.sharedrive.sdk.android.modelV2.response.FolderListResponseV2;
import com.huawei.sharedrive.sdk.android.modelV2.response.FolderResponse;
import com.huawei.sharedrive.sdk.android.serviceV2.FolderClientV2;

public class FolderHelper {
	/** FolderHelper context */
	private Context context;

	/**
	 * FolderHelper construct function
	 * 
	 * @param context
	 *            Context
	 */
	public FolderHelper(Context context) {
		super();
		this.context = context;
	}

	/**
	 * FolderHelper construct function
	 */
	public FolderHelper() {
		super();
	}

	/**
	 * @param ownerID
	 * @param request
	 * @param authorization
	 * @return
	 */
	public static FolderResponse createFolder(String ownerID, FolderCreateRequest request, String authorization) {

		FolderResponse folderResponse = null;
		try {
			folderResponse = FolderClientV2.getInstance().create(ownerID, request, authorization);

		} catch (ClientException e) {
			// Auto-generated catch block
			e.printStackTrace();
		}
		return folderResponse;
	}

	/**
	 * 
	 * @param fbr
	 * @return 
	 * @throws ClientException
	 */
	public String deleteFolder(FolderBaseRequest fbr) throws ClientException {
		String deleteFolderRes = FolderClientV2.getInstance().deleteFolder(fbr);
		return deleteFolderRes;
	}

	/**
	 * @param ownerID
	 * @param folderID
	 * @param authorization
	 * @param request
	 * @return 
	 * @throws ClientException
	 */
	public FolderResponse moveFolder(final String ownerID, final String folderID, String authorization,
			FolderMoveRequstV2 request) throws ClientException {
		FolderResponse response = FolderClientV2.getInstance().moveFolder(ownerID, folderID, authorization, request);
		return response;

	}

	/**
	 * @param ownerID
	 * @param folderID
	 * @param authorization
	 * @param request
	 * @return
	 * @throws ClientException
	 */
	public FolderResponse copyFolder(final String ownerID, final String folderID, String authorization,
			FolderCopyRequstV2 request) throws ClientException {
		FolderResponse response = FolderClientV2.getInstance().copyFolder(ownerID, folderID, authorization, request);
		return response;
	}

	/**
	 * @param request
	 * @param name
	 * @return 
	 * @throws ClientException
	 */
	public FolderResponse renameFolderInfo(FolderBaseRequest request, String name) throws ClientException {
		FolderResponse response = FolderClientV2.getInstance().renameFolderInfo(request, name);
		return response;
	}

	/**
	 * @param request
	 * @return
	 * @throws ClientException
	 */
	public FolderResponse getFolderInfo(FolderBaseRequest request) throws ClientException {
		FolderResponse response = FolderClientV2.getInstance().getFolderInfo(request);
		return response;
	}

	/**
	 * @param request
	 * @param authorization
	 * @return 
	 * @throws ClientException
	 */
	public FolderListResponseV2 getFolderInfoList(FolderListRequestV2 request, String authorization) throws ClientException {
		FolderListResponseV2 response = FolderClientV2.getInstance().getFolderInfoList(request, authorization);
		return response;
	}
}
